package com.github.rxyor.example.spring.transaction.airplane.controller;

import com.github.rxyor.example.spring.transaction.airplane.entity.AirplaneDO;
import com.github.rxyor.example.spring.transaction.airplane.service.AirplaneRepo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 *<p>
 *
 *</p>
 *
 * @author liuyang
 * @date 2019-05-29 Wed 14:56:00
 * @since 1.0.0
 */
@Slf4j
@Api(value = "airplane")
@RestController
@AllArgsConstructor
@RequestMapping("/airplane")
public class AirplaneController {

    private final AirplaneRepo airplaneRepo;

    @ApiOperation(value = "保存", httpMethod = "POST")
    @PostMapping("/save")
    @ResponseBody
    public Object save(
      @ApiParam("保存参数") @RequestBody AirplaneDO param
    ) {
        airplaneRepo.save(param);
        return param;
    }
}
